import { _decorator, Component, Node, Material, Vec3, Vec4} from 'cc';


const { ccclass, property } = _decorator;
@ccclass('WoodParam') // 用 @ccclass 声明类为 Cocos 组件
export class WoodParam extends Component {

    @property(Node) lightNode!: Node;
    @property(Material) woodMat!: Material;

    protected update(dt: number): void {
        // console.log("WoodParam update");
        const forward: Vec3 = this.lightNode.forward;
        const forwardV4: Vec4 = new Vec4(forward.x, forward.y, forward.z, 1);
        // console.log("forwardV4", forwardV4);
        this.woodMat.setProperty('mLightDir', forwardV4);
    }

}

